let v=new Vue({
    el:".headMain",
    data:{
        loginUser:{
            loginName:"",
        }
    }
})

function LoginVerify(){
    console.log("进行登陆验证");
    $.ajax({
        url:"loginVerify",
        type:"get",
        dataType:"json",
        success:function (response){
            console.log("进入登录验证");
            if(response.state==300){
                alert(response.message);
                window.location.href="login.html";
            }
            else if(response.state==200){
                console.log("当前登录用户:");
                console.log(response.data);
                v.loginUser.loginName=response.data.loginUser.loginName;
            }
        }
    })
}
document.addEventListener('DOMContentLoaded', function() {
    const dropdowns = document.querySelectorAll('.dropdown');
    dropdowns.forEach(dropdown => {
        const toggleButton = dropdown.querySelector('.dropdown-toggle');
        const menu = dropdown.querySelector('.dropdown-menu');

        toggleButton.addEventListener('click', function(event) {
            event.preventDefault();
            menu.classList.toggle('show');
        });
        window.addEventListener('click', function(event) {
            if (!dropdown.contains(event.target)) {
                menu.classList.remove('show');
            }
        });
    });
});